﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common.ViewModels
{
    [Description("报警代码")]
    public enum AlarmCode
    {
        [Description("连接失败")]
        CONNECT_FAIL,
        [Description("设备失联，请检查通信连接")]
        DEVICE_LOST,
        [Description("原点丢失，请使用寻位功能恢复，或重新初始化")]
        DEVICE_HOME_LOST,
        [Description("设备未使能")]
        DEVICE_INACTIVE,
        [Description("ACTIVE_FAIL")]
        ACTIVE_FAIL,
        [Description("清除原点失败")]
        ABORD_HOME_FAIL,
        [Description("通信发生异常")]
        COMM_ERROR,
        [Description("设备发生报警，请在设备上查看")]
        DEVICE_ALARM,

        /* 循环线报警代码 */
        [Description("程序异常，请联系工程师")]
        LINE_PROGRAM_EXCEPTION,
        [Description("位置发生突变，可尝试复位")]
        CAR_POS_ERROR_TOO_MUCH,
        [Description("发生未知异常，请联系工程师")]
        LINE_EXP_EXCEPTION,

        /* 小车报警代码 */
        [Description("端口打开失败，请检查端口是否正确并重启软件")]
        COM_OPEN_FAILD,
        [Description("端口未打开")]
        COM_NOT_OPEN,
        [Description("小车位置错误报警，请检查是否有干涉，清除报警后手动使能")]
        CAR_POSITION_ERROR,
        [Description("小车当前工位感应器报警，请检查工位感应器")]
        CAR_CURRENT_STATION_INPUT_ALARM,
        [Description("小车偏离当前工位位置，请检查是否到位")]
        CAR_STATION_POSITION_ERROR,
        [Description("小车回零失败")]
        CAR_HOME_FAIL,
        [Description("小车设置偏移量失败")]
        CAR_SET_HOME_OFFSET_FAIL,
        [Description("小车驱动器失联，请检查通信")]
        CAR_DRIVE_LOST,
        [Description("小车运动失败，无法到达目标位置，请排除干涉")]
        CAR_MOVE_FAIL,

        [Description("正限位触发")]
        POSITIVE_LIMIT,
        [Description("负限位触发")]
        NEGATIVE_LIMIT,

        /* 摆渡报警代码 */
        [Description("摆渡未回零，请手动回零")]
        BOAT_NOT_HOME,
        [Description("摆渡未使能，请手动使能")]
        BOAT_NOT_ACTIVE,
        [Description("摆渡到位感应器报警")]
        BOAT_ARRIVE_SENSOR_SHOULD_SET,
        [Description("负末端感应器报警")]
        NEGATIVE_COMBINE_SENSOR_ALARM,
        [Description("正末端感应器报警")]
        POSITIVE_COMBINE_SENSOR_ALARM,
        [Description("摆渡轴位置偏离")]
        BOAT_POS_DEVIATED,
        [Description("未定义轴")]
        AXIS_UNDEFINED,

        /* 外设报警代码 */
        [Description("外设通信断开，请检查连接")]
        EXTERNAL_DEVICE_LOST,
        [Description("EIP组件激活失败，请联系工程师")]
        EXTERNAL_DEVICE_LOGIC_ALARM,
        [Description("外设指定了错误的目标工位")]
        EXTERNAL_DEVICE_REFER_WRONG_TARGET,
        [Description("外设报警中，请在对应设备中查看具体消息")]
        EXTERNAL_DEVICE_ALARMING,

        [Description("启动扫码失败")]
        CODE_SCAN_FAIL,
        [Description("未读取到条码标识，检查扫码枪是否对准，条码是否破损")]
        CODE_READ_FAIL,

        [Description("回零失败")]
        HOME_FAIL,

        /*工站*/

        [Description("外设逻辑错误，请检查参数")]
        EXTERNAL_DEVICE_LOGIC_ERROR,

        [Description("小车位于拼接处，请检查小车尺寸模型是否正确")]
        CAR_ON_COMBINE,

        [Description("安全信号缺失")]
        STATION_SAFE_LOST,
        [Description("站点设备报警")]
        STATION_DEVICE_ALARM,
        [Description("配置方式暂不支持")]
        CONFIG_NOT_SUPPORT,

        [Description("设备配置不正确")]
        DEVICE_CONFIG_ERROR,

        [Description("目标无法到达，请检查工站位置配置")]
        TARGET_UNREACHABLE,
        [Description("速度设置过低，请检查配置")]
        SPEED_TOO_LOW,

        [Description("未定义工序")]
        ROUTE_UNDEFINE,
        [Description("站点缺料")]
        STATION_PRODUCT_LOST,

        [Description("一般报警")]
        GENERAL_FAULT,

        [Description("等待输入信号1超时")]
        CAR_DI_1_PREDICT_TIMEOUT,
        [Description("等待输入信号2超时")]
        CAR_DI_2_PREDICT_TIMEOUT,

        [Description("输入点报警")]
        INPUT_ALARM,

        [Description("轴原点丢失，请手动回零或者重新初始化")]
        AXIS_HOME_LOST,

        [Description("执行失败，请检查配置")]
        MOTION_FAIL,

        /// <summary>
        /// 用户程序异常
        /// </summary>
        USER_PROGRAM_EXCEPTION,
        /// <summary>
        /// 用户程序初始化失败
        /// </summary>
        USER_PROGRAM_INIT_FAILED
    }
}
